from datetime import datetime
from exit import db

class UserModel(db.Model):
    __tablename__ = 'userInfo'
    customerID = db.Column(db.Integer, primary_key=True, autoincrement=True)
    customerName = db.Column(db.String(8), nullable=False)
    PID = db.Column(db.String(18), nullable=False)
    telephone = db.Column(db.String(20), nullable=False)
    address = db.Column(db.String(50), nullable=False)

class CardModel(db.Model):
    __tablename__ = 'cardInfo'
    cardID = db.Column(db.String(16), primary_key=True)
    curID = db.Column(db.String(10))
    savingID = db.Column(db.Integer)
    openDate = db.Column(db.DateTime, default=datetime.now)
    openMoney = db.Column(db.Numeric(18, 2))
    balance = db.Column(db.Numeric(18, 2))
    passwd = db.Column(db.String(6))
    IsReportLoss = db.Column(db.String(3))
    customerID = db.Column(db.Integer)

class TradeModel(db.Model):
    __tablename__ = 'tradeInfo'
    tradeID = db.Column(db.Integer, primary_key=True, autoincrement=True)
    cardID = db.Column(db.String(19))
    tradeDate = db.Column(db.DateTime, default=datetime.now)
    tradeType = db.Column(db.String(6))
    tradeMoney = db.Column(db.Numeric(18, 2))
    remark = db.Column(db.Text)

class DepositModel(db.Model):
    __tablename__ = 'deposit'
    savingID = db.Column(db.Integer, primary_key=True, autoincrement=True)
    savingName = db.Column(db.String(20), nullable=False)
    descrip = db.Column(db.String(50))